package com.local.es.constants;

public class ESConstants {

    public static final String ES_GOODS_INDEX = "es_goods";

    public static final String ES_GOODS_UPDATE_QUEUE = "es-demo.goods-update-queue";
    public static final String ES_GOODS_DELETE_QUEUE = "es-demo.goods-delete-queue";

    /**
     * es_goods索引库的结构模版
     */
    public static final String ES_GOODS_INDEX_TEMPLATE = "{\n" +
            "  \"settings\": {\n" +
            "    \"analysis\": {\n" +
            "      \"analyzer\": { //自定义分词器\n" +
            "        \"text_analyzer\": { //分词器名称\n" +
            "          \"tokenizer\": \"ik_max_word\", //将文本按ik_max_word的规则切割成词条\n" +
            "          \"filter\": \"py\" //将tokenizer生成的词条进一步处理，如：拼音处理、大小写转换、同义词处理\n" +
            "        },\n" +
            "        \"completion_analyzer\": { //搜索建议的分词器\n" +
            "          \"tokenizer\": \"keyword\", //keyword\n" +
            "          \"filter\": \"py\"\n" +
            "        }\n" +
            "      },\n" +
            "      \"filter\": {\n" +
            "        \"py\": {\n" +
            "          \"type\": \"pinyin\",\n" +
            "          \"keep_full_pinyin\": false,\n" +
            "          \"keep_joined_full_pinyin\": true,\n" +
            "          \"keep_original\": true,\n" +
            "          \"limit_first_letter_length\": 16,\n" +
            "          \"remove_duplicated_term\": true,\n" +
            "          \"none_chinese_pinyin_tokenize\": false\n" +
            "        }\n" +
            "      }\n" +
            "    }\n" +
            "  },\n" +
            "  \"mappings\": {\n" +
            "    \"properties\": {\n" +
            "      \"goodsId\": {\n" +
            "        \"type\": \"keyword\"\n" +
            "      },\n" +
            "      \"goodsName\": {\n" +
            "        \"type\": \"text\",\n" +
            "        \"analyzer\": \"text_analyzer\",\n" +
            "        \"search_analyzer\": \"ik_smart\",\n" +
            "        \"copy_to\": \"all\"\n" +
            "      },\n" +
            "      \"goodsImg\": {\n" +
            "        \"type\": \"keyword\",\n" +
            "        \"index\": false\n" +
            "      },\n" +
            "      \"brand\": {\n" +
            "        \"type\": \"keyword\",\n" +
            "        \"copy_to\": \"all\"\n" +
            "      },\n" +
            "      \"intro\": {\n" +
            "        \"type\": \"text\",\n" +
            "        \"analyzer\": \"text_analyzer\",\n" +
            "        \"search_analyzer\": \"ik_smart\",\n" +
            "        \"copy_to\": \"all\"\n" +
            "      },\n" +
            "      \"stock\": {\n" +
            "        \"type\": \"integer\",\n" +
            "        \"index\": false\n" +
            "      },\n" +
            "      \"origiPrice\": {\n" +
            "        \"type\": \"integer\"\n" +
            "      },\n" +
            "      \"salePrice\": {\n" +
            "        \"type\": \"integer\"\n" +
            "      },\n" +
            "      \"tag\": {\n" +
            "        \"type\": \"keyword\",\n" +
            "        \"copy_to\": \"all\"\n" +
            "      },\n" +
            "      \"all\": {\n" +
            "        \"type\": \"text\",\n" +
            "        \"analyzer\": \"text_analyzer\",\n" +
            "        \"search_analyzer\": \"ik_smart\"\n" +
            "      },\n" +
            "      \"suggestion\": {\n" +
            "        \"type\": \"completion\",\n" +
            "        \"analyzer\": \"completion_analyzer\"\n" +
            "      }\n" +
            "    }\n" +
            "  }\n" +
            "}";
}
